package com.samsung.svmc.moneymanager.adapter;

import java.util.List;

import com.samsung.svmc.moneymanager.object.TienTe;

import android.content.Context;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

public class TienTeAdapter extends ArrayAdapter<TienTe> {
	
	private Context context;
    private List<TienTe> itemList;

	public TienTeAdapter(Context context, int textViewResourceId,
			List<TienTe> objects) {
		super(context, textViewResourceId, objects);
		// TODO Auto-generated constructor stub
		this.context = context;
		this.itemList = objects;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		TextView label = new TextView(context);
		label.setTextColor(Color.BLACK);
		label.setText(itemList.get(position).get_TenTienTe());
		return label;
	}
	
	@Override
	public View getDropDownView(int position, View convertView, ViewGroup parent) {
		LayoutInflater inflater = LayoutInflater.from(context);
        convertView = inflater.inflate(
                com.samsung.svmc.moneymanager.R.layout.spinners_xml, parent, false);
        TextView tv = (TextView) convertView
                .findViewById(com.samsung.svmc.moneymanager.R.id.txtItem);
        tv.setText(itemList.get(position).get_TenTienTe());
        tv.setTextColor(Color.BLACK);       
        return convertView;
	}
}
